<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>进场确认</title>
<%@ include file="/commons/validation.jsp"%>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>


<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">
<link href="${ctx}/scripts/grid.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/show.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/listTable.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/global.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/tags/checkbox/checkbox.js"></script>
<script type="text/javascript" src="${ctx}/scripts/tags/unitedselect/UnitedSelect.js"></script>

<script>
function submitWin(){
		var isTrue=$("checkConfirmForm").fireEvent("onSubmit");
  		if(!isTrue)return;

		var tableObj = document.getElementById("item_table");
		var trArray = tableObj.getElementsByTagName("tr");
		var selectedId = new Array();

		var itemPer = "";
		for(var i = 0; i < trArray.length; i++){

			var itemConfigId = trArray[i].id; //行主键（确认项目配置ID）
			var keyword = $('kw_'+itemConfigId).value;
			var ckCID = "ckC_"+itemConfigId;	//复选框Id
			var remarkId = "remark_"+itemConfigId; //备注Id

			var checkYn = "";
			if ($(ckCID).checked){
				checkYn = 1;
			}else{
				checkYn = 0;
			}

			var remark = $(remarkId).value;    //备注

			var RexStr = /\#!end!#/g  ;        //去掉备注里的特殊字符串  #!end!#
    		remark = remark.replace(RexStr,"");

			RexStr =  /\#!!#/g ;       //去掉备注里的特殊字符串  #!&!#
       	 	remark = remark.replace(RexStr,"");

			itemPer += itemConfigId+"#!!#"+keyword+"#!!#"+checkYn+"#!!#"+remark+"#!end!#";
		}

  			var requisitionId = $('requisitionId').value;
			var url = "${ctx}/renovation_renovateRequisitionAction.do?method=checkConfirmItems&requisitionId="+requisitionId;
			new Ajax.Request(url,
				         { method:'post',
						   parameters:{par:itemPer},
						   onComplete:back
						 });
	}
	function back(response){
	ajaxSubmitException(response.responseText);
		findFrame('main').refleshRenReqFrame(); //刷新主页面列表
		windowClose();
	}


	function remarkOver(keyword){//鼠标从备注输入框移入
		var remarkId = "remark_"+keyword; //备注

		var remark = $(remarkId).value;    //备注

		var RexStr = /\#!end!#/g  ;        //去掉备注里的特殊字符串  #!end!#
    	remark = remark.replace(RexStr,"");

		RexStr =  /\#!!#/g ;       //去掉备注里的特殊字符串  #!!#
       	remark = remark.replace(RexStr,"");

		$(remarkId).value=remark;

		$(remarkId).className = 'inputOver1 max-length-100'
	}

	function remarkOut(keyword){//鼠标从备注输入框移入
		var remarkId = "remark_"+keyword; //备注
		$(remarkId).className = 'inputNoStyle1  max-length-100';
	}


</script>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg">
    <table border="0" cellpadding="0" cellspacing="0">
      <tr><td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">进场确认项目</span></td></tr>
    </table>
    </td>
  </tr>
  <tr><td class="aux_header_line_1"></td></tr>
  <tr><td class="aux_header_line_2"></td></tr>
  <tr>
    <td class="content">
    <div style="overflow: auto;height: 150px">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="aux_outtable_color">
      <tr>
        <td>
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tab_line">
	        <tr>
	        <td valign="top">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" >
	          <tr>
	            <td colspan="5" >

	            <table width="100%" border="0" cellspacing="0" cellpadding="0" id="crmGrid" class="gridControl gridArea">
	                <tr>
	                  <td width="10%" class="align_left"  onMouseOver="this.className='grid_sort_on align_left'" onMouseOut="this.className='align_left'"><span class="grid grid_head_line">序 号</span></td>
	                      <td width="30%" class="align_left"  onMouseOver="this.className='grid_sort_on align_left'" onMouseOut="this.className='align_left'"><span class="grid grid_head_line">确认项目</span></td>
						  <td width="50%" class="align_left"  onMouseOver="this.className='grid_sort_on align_left'" onMouseOut="this.className='align_left'"><span class="grid grid_head_line">备 注</span></td>
	                      <td width="10%" class="align_left" onMouseOver="this.className='grid_sort_on align_left'" onMouseOut="this.className='align_left'">确 认</td>
	                      </tr>
	              </table>
<form id="checkConfirmForm" name="checkConfirmForm"  method="post" action=""  class="required-validate">
	                <input id="requisitionId" name="requisitionId" value="${requisitionId }" type="hidden">
	                <table width="100%" id="item_table" border="0" cellspacing="0" cellpadding="0"  class='gridData2'>

	                  <c:forEach items="${confirms}" var="item" varStatus="sta">
					  <tr class="grid" id="${item.itemConfigId }">
					     	<td width="10%" class="grid align_left">${sta.count}</td>
 							<td width="30%" class="grid align_left">${item.itemConfig}</td>
 							<td width="50%" class="grid align_left">
 								<input id="kw_${item.itemConfigId }" name="kw_${item.itemConfigId }" value="${item.keyword }" type="hidden">
	                  			<input name="remark_${item.itemConfigId }" id="remark_${item.itemConfigId }" type="text"
	                  					class="inputNoStyle1 validate-char max-length-100"
	                  					onblur="remarkOut(${item.itemConfigId });"
	                  					onMouseOver="remarkOver('${item.itemConfigId }');"
	                  					onMouseOut="remarkOut('${item.itemConfigId }');"
	                  					value="${item.remark}" size="120" maxlength="100" />
	                  		 </td>
	                  		 <td width="10%" class="grid align_left">
	                  		  	<input type="checkbox" id="ckC_${item.itemConfigId}" name="ckC_${item.itemConfigId}" <c:if test="${item.checkYn == 1}">checked="checked" </c:if> />
	                  		 </td>
					  </tr>
	                  </c:forEach>
	                </table>
</form>
	              </td>
	          </tr>
	        </table></td>
          </tr>
        </table></td>
      </tr>
    </table>
    </div>
    </td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
         <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="submitWin();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onBlur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 确 认</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onblur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 取 消</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>